<?php

    // +----------------------------------------------------------------------
    // | 认证提交
    // +----------------------------------------------------------------------
    // | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
    // +----------------------------------------------------------------------
    // | Author: 微尘 <yicmf@qq.com>
    // +----------------------------------------------------------------------

    namespace app\model\ucenter;

    use app\model\file\Image;

    class UserAuth extends Common
    {

        public function user()
        {
            return $this->belongsTo(User::class);
        }

        public function front()
        {
            return $this->belongsTo(Image::class, 'front_id');
        }

        public function hand()
        {
            return $this->belongsTo(Image::class, 'hand_id');
        }

        public function back()
        {
            return $this->belongsTo(Image::class, 'back_id');
        }

        public function getStatusInfoAttr($value, $data)
        {
            switch ($data['status']) {
                case -1:
                    $text = '拒绝';
                    break;
                case 0:
                    $text = '提交';
                    break;
                case 1:
                    $text = '通过';
                    break;
                default:
                    $text = '未知';
                    break;
            }
            return $text;
        }

        protected $type = [];
    }
